<template>
  <div class="content">
    <div class="list-wrap" v-if="showList">
      <div v-if="nav.id === 0" class="all-wrap">
        <div class="entry-wrap">
          <div>
            <div class="title">热门词条榜</div>
            <ul>
              <li
                v-for="(item, index) in hotEntry"
                :key="index"
              >
                {{index+1}}<span @click="toProfile(item)">{{item.title}}</span>
              </li>
            </ul>
          </div>
          <div>
            <div class="title">最新词条榜</div>
            <ul>
              <li
                v-for="(item, index) in newEntry"
                :key="index"
              >
                {{index+1}}<span @click="toProfile(item)">{{item.title}}</span>
              </li>
            </ul>
          </div>
        </div>
        <div class="recommend-wrap">
          <div class="title">casino 实力推荐</div>
          <el-row class="block-wrap" :gutter="10">
            <el-col
              v-for="(item, index) in recommendList"
              :key="index"
              :span="3"
            >
              <div class="img-wrap">
                <img :src="`${$baseImgUrl}${item.img}`"/>
              </div>
              <div class="name">{{item.name}}</div>
            </el-col>
          </el-row>
        </div>
      </div>
      <div v-else class="list-wrap">
        <ul>
          <li
            v-for="(item, index) in entryList"
            :key="index"
          >
            <div
              class="word"
            >
              <span class="title" @click="toProfile(item)">{{item.title}}</span>
              <span class="suffix" @click.stop>【{{item.suffix}}】</span>
            </div>
            <div class="date">{{item.date}}</div>
          </li>
        </ul>
      </div>
    </div>
    <div class="profile-wrap" v-else>
      <div class="profile-title">
        {{profileContent}}
      </div>
      <div class="profile-content">
        {{profileContent}}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: '',
  props: {
    nav: {
      type: Object
    },
    showList: {
      type: Boolean
    },
    hotEntry: {
      type: Array
    },
    newEntry: {
      type: Array
    },
    entryList: {
      type: Array
    },
    recommendList: {
      type: Array
    }
  },
  data() {
    return {
      profileId: null,
      profileContent: ''
    };
  },
  methods: {
    toProfile(data) {
      this.$emit('showList', false);
      this.profileId = data.id;
      this.profileContent = data.title;
    }
  }
};
</script>

<style lang="less" scoped>
  @import '../../../less/global.less';
  .content {
    flex: 1;
    padding: 0 20px;
    .all-wrap {
      .entry-wrap {
        display: flex;
        & > div {
          flex: 1;
        }
        .title {
          margin-bottom: 10px;
          font-size: 16px;
          color: #333;
        }
        li {
          height: 24px;
          line-height: 24px;
          font-size: 12px;
          color: #888;
          span {
            margin-left: 10px;
            cursor: pointer;
            &:hover {
              color: @mainBgHoverColor;
            }
          }
        }
      }
      .recommend-wrap {
        margin-top: 10px;
        .title {
          padding-left: 10px;
          height: 40px;
          line-height: 40px;
          border-top: 1px solid #ddd;
          border-bottom: 1px solid #ddd;
        }
        .block-wrap {
          padding-top: 10px;
          img {
            display: block;
            margin: 0 auto;
            width: 80px;
            height: 80px;
            border-radius: 10px;
          }
          .name {
            line-height: 30px;
            text-align: center;
            color: #666;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
        }
      }
    }
    .list-wrap {
      li {
        display: flex;
        height: 30px;
        line-height: 30px;
        font-size: 12px;
        color: #666;
        border-bottom: 1px solid #eee;
        &:last-child {
          border-bottom: 0;
        }
        .word {
          flex: 1;
          cursor: pointer;
          .suffix {
            color: #aaa;
            cursor: default;
          }
        }
        .date {
          flex: 0 0 200px;
        }
      }
    }
  }
  .profile-wrap {
    .profile-title {
      padding-left: 10px;
      line-height: 40px;
      font-size: 16px;
      background-color: #eee;
    }
    .profile-content {
      padding: 10px;
      color: #888;
    }
  }
</style>
